Skip to content

Fix @reap_threads usage in test_free_threading.test_json - #158937

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:test_ft_json
Oct 10, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:test_ft_json

Conversation

@vstinner

@vstinner vstinner commented Oct 6, 2026

Copy link
Copy Markdown
Member

Use the decorator on test methods, not on the whole class.

Previously, test_json ran no tests:

$ ./python -m test -v test_free_threading.test_json -v
...
Ran 0 tests in 0.000s

NO TESTS RAN

Add also a check in @reap_threads to detect misuse (on a class).

Use the decorator on test methods, not on the whole class.

Previously, test_json ran no tests:

    $ ./python -m test -v test_free_threading.test_json -v
    ...
    Ran 0 tests in 0.000s

    NO TESTS RAN

Add also a check in @reap_threads to detect misuse (on a class).
@StanFromIreland

Copy link
Copy Markdown
Member

Hugo already has a PR for this: #158668

@vstinner

vstinner commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

@hugovk @eendebakpt: Would you mind to review this change?

Compared to @hugovk's PR gh-158668, my PR moves @reap_threads on each test method rather than removing it, and it also adds a check to @reap_threads to detect misusage of the decorator (fails if the argument is a class).

@vstinner
vstinner merged commit 565f76f into python:main Oct 10, 2026
61 checks passed
@vstinner
vstinner deleted the test_ft_json branch October 10, 2026 12:14
@miss-islington-app

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Oct 10, 2026

Copy link
Copy Markdown

GH-159115 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Oct 10, 2026
@vstinner

Copy link
Copy Markdown
Member Author

The issue is now nagging me on buildbots, since I added a new check on buildbots to log 1 test run no tests: as a warning: Free Threading buildbot turned orange. So I went a ahead and I merged my fix.

@bedevere-app

bedevere-app Bot commented Oct 10, 2026

Copy link
Copy Markdown

GH-159116 is a backport of this pull request to the 3.14 branch.

@vstinner

Copy link
Copy Markdown
Member Author

I also backported the if inspect.isclass(func): check to 3.14: #159116.

vstinner added a commit that referenced this pull request Oct 10, 2026
…58937) (#159115)

Fix @reap_threads usage in test_free_threading.test_json (GH-158937)

Use the decorator on test methods, not on the whole class.

Previously, test_json ran no tests:

    $ ./python -m test -v test_free_threading.test_json -v
    ...
    Ran 0 tests in 0.000s

    NO TESTS RAN

Add also a check in @reap_threads to detect misuse (on a class).
(cherry picked from commit 565f76f)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this pull request Oct 10, 2026
Detect @reap_threads misuse (on a class) (#158937)

(cherry picked from commit 565f76f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants